'use strict';

const Controller = require('egg').Controller;

class OrderController extends Controller {
  async unpayList() {
    const tid = this.ctx.request.query.tid;
    const status = this.ctx.request.query.status;
    const result = await this.ctx.service.order.order.unpayInfo(tid,status);
    if(result === 'error'){
        this.ctx.code = 301;
    }else{
        this.ctx.code = 200;
    }
    this.ctx.body = result;
  }

  async settleOrder(){
      const params = this.ctx.request.body;
      const result = await this.ctx.service.order.order.settleOrder(params.billcode);
      if(result === 'success'){
          this.ctx.code = 200;
      }else{
          this.ctx.code = 301;
      }
      this.ctx.body = result;
  }
}

module.exports = OrderController;
